import iplot.iplothelper as hp

pdata = hp.get_data('eurusd_daliy','')
break_totle = len(pdata)
last_priceObj = None
break_top_num = 0
break_down_num = 0



break_totle = 0
contans_totle = 0
break_double_totle = 0
for index,p in enumerate( pdata[2:]):
    # 连续三天突破最高或者最低次
    condition1 =  p.high > pdata[index-1].high  and pdata[index-1].high >  pdata[index-2].high
    condition2 =  p.low < pdata[index-1].low  and pdata[index-1].low <  pdata[index-2].low
    if condition1 or condition2:
        break_totle += 1

    # 被包含次数
    condition3 = p.high < pdata[index -1 ].high and p.low > pdata [index - 1].low
    if condition3:
        contans_totle += 1
    # 破高又破低
    condition4 =  p.high > pdata[index -1 ].high and p.low < pdata [index - 1].low
    if condition4:
        break_double_totle += 1
print('总天数 %i',len(pdata[2:]))
print('连续三天突破最高或者最低次数 %i' % break_totle)
print('被包含次数 %i' % contans_totle)
print('破高又破低 %i' % break_double_totle)